#ifndef __QUEUE_H__
#define __QUEUE_H__
#include <stdint.h>
#include <stdbool.h>
#include "linuxlist.h"

#define LIST_QUEUE

#ifdef LIST_QUEUE

struct QueueItem
{
	struct list_head entry;
	void *item;
};
struct QueueNode
{
	struct list_head head;
	uint32_t cnt;
};
struct Queue
{
	struct QueueNode busyNode;
	struct QueueNode idleNode;
    uint32_t itemNums;
    uint32_t itemSize;
};

#else
struct Queue
{
    void *pBase;
    uint32_t maxSize;
    uint32_t front;
    uint32_t rear;
    uint32_t itemSize;
};


struct Queue * CreateQueue(uint32_t itemNums, uint8_t itemSize);
void ReleaseQueue(struct Queue* queue);
bool FullQueue(struct Queue *queue);
bool EmptyQueue(struct Queue *queue);
bool PushQueue(struct Queue *queue, void* item);
bool PopQueue(struct Queue *queue, void* item);

#endif

#endif //__QUEUE_H__
